<script type='text/javascript' src="<?php echo $this->basePath('public/css/dbblack/js/artdialog/artDialog.js?skin=simple'); ?>"></script>
<script type='text/javascript' src="<?php echo $this->basePath('public/css/dbblack/js/artdialog/plugins/iframeTools.js'); ?>"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $this->basePath('public/css/dbblack/js/form/style.css'); ?>"/>
<script type='text/javascript' src="<?php echo $this->basePath('public/css/dbblack/js/form/form.js'); ?>"></script>
<div class="magic-bg">
	<div class="simple-box"   style="right:18%">
		<div class="title">
			<div class="sub-1"><h1><?php echo $this->translate('会员登录'); ?></h1></div>
			<div class="sub-2"><a href="<?php echo $this->url('frontuser/default',array('action'=>'register')); ?>"><?php echo $this->translate('立即注册'); ?></a></div>
		</div>
		<form class="reg-box" method="post" callback="checkForm">
			<input type="hidden" name="<?php echo $this->login_csrf['name']; ?>" value="<?php echo $this->login_csrf['value']; ?>" />
			<input type="hidden" name="http_referer" value="<?php echo $this->http_referer; ?>" />
			<ul class="form">
				<?php if (isset($this->message) and $this->message != '') { ?>
					<label class="invalid-msg"><?php echo $this->message; ?></label>
				<?php } ?>
				<?php
				$userPlaceholder = $this->translate('会员名称');
				if($this->email_login_state == 'true') $userPlaceholder .= '/'.$this->translate('电子邮箱');
				if($this->phone_login_state == 'true') $userPlaceholder .= '/'.$this->translate('手机号码');
				?>
				<li><span class="perfix fa">&#xf007;</span><input name="user_name" id="user_name"  class="input" pattern="required" placeholder="<?php echo $userPlaceholder; ?>" alt="<?php echo $this->translate('请输入会员登录名称！'); ?>"><label></label></li>
				<li><span class="perfix fa">&#xf084;</span><input class="input" name="user_password" type="password" placeholder="<?php echo $this->translate('输入会员密码'); ?>" pattern="required" alt="<?php echo $this->translate('请输入密码！'); ?>"></li>
				<?php if ($this->frontwebsite()->websiteCaptchaState('user_login_captcha') == 'true') { ?>
				<li>
					<span class="perfix fa">&#xf02a;</span><input type="text" name="captcha_code" id="captcha_code" pattern="\w{5}" maxlength="5" style="width: 100px;" alt="验证码不正确" placeholder="验证码"><span id="captcha_id"></span>
				</li>
				<?php } ?>
				<li><label>[<a href="<?php echo $this->url('frontuser/default',array('action'=>'forgotpasswd')); ?>"><?php echo $this->translate('忘记密码?'); ?></a>]</label></li>
				<li><button class="btn btn-main " style="padding:10px 40px; width:100%"><?php echo $this->translate('登录'); ?></button></li>
				<?php if($this->frontwebsite()->getUserOtherLoginState() == 'true') { ?>
					<li>
						<hr>
						<?php
						$otherLoginArray = $this->frontwebsite()->getUserOtherLoginIni();
						if(!empty($otherLoginArray)) {
							foreach($otherLoginArray as $othKey => $othValue) {
								if($othValue['login_state'] == 'true') {
									$othKey = strtolower($othKey);
									?>
									<a href="<?php echo $this->url('frontuser/default',array('action'=>'otherlogin'), array('query'=>array('login_type'=>$othKey))); ?>" style="margin-right: 8px;"><img src="<?php echo $this->basePath('public/img/login/'.$othKey.'_login.png'); ?>"></a>
									<?php
								}
							}
						}
						?>
					</li>
				<?php } ?>
			</ul>
		</form>
	</div>
</div>
<script type="text/javascript">
	<?php if ($this->frontwebsite()->websiteCaptchaState('user_login_captcha') == 'true') { ?>
    $.ajaxSetup({
        async: false
    });
    function checkForm(e){
        if(e) return false;
        else {
            var captcha_state = true;
            $.post("<?php echo $this->url('shopfront/default/captcha-check',array('action'=>'captcha','captcha_check'=>1)); ?>",{captcha_code:$('#captcha_code').val()},function(data){
                if(data == 'false') {
                    autoValidate.showMsg({id:document.getElementById('captcha_code'),error:true,msg:'<?php echo $this->translate('验证码错误！'); ?>'});
                    captcha_state = false;
                }
            });
            if(!captcha_state) return false;
        }
    }
	//验证码添加
	function captchaAdd() {
		$.get("<?php echo $this->url('shopfront/default',array('action'=>'captcha')); ?>",'',
				function(data){
					$("#captcha_id").html('<img id="captcha_img" src="<?php echo $this->basePath('/'); ?>'+data.captcha_file+'" border="0" ><a href="javascript:;" onclick="captchaAdd()"><?php echo $this->translate('换一张'); ?></a>');
				},'json');
	}
	captchaAdd();
    <?php } else { ?>
    function checkForm(e){

    }
    <?php } ?>
</script>
